<template>
  <!-- 垃圾分类列表项 组件 -->
  <view>
    <!-- 垃圾分类item -->
    <view class="shadow d-flex j-start allbox" @click="toDetail()">
      <!-- 图片 -->
      <view class="view-img">
        <image class="refuse-img" :src="refuseclass.img[0]"></image>
      </view>
      <!-- 右侧盒子 -->
      <view class="rightbox">
        <view class="refuse-topbox">
          <!-- 地点 -->
          <view class="u-line-2 refuse-site">{{refuseclass.address}}</view>
          <!-- 状态  审核中 or 已通过   -->
          <view class="refuse-status-ing" v-if="refuseclass.status === '审核中'">{{refuseclass.status}}</view>
          <view class="refuse-status-finish" v-if="refuseclass.status === '已通过'">{{refuseclass.status}}</view>
          <view class="refuse-status-noPass" v-if="refuseclass.status === '未通过'">{{refuseclass.status}}</view>
        </view>
        <view class="refuse-bottombox">
          <!-- 自动获取的时间 -->
          <view class="refuse-time u-line-3" style="width: 180rpx;" v-if="refuseclass.status === '审核中'">
            <view>打卡时间：</view>
          {{refuseclass.createTime}}
          </view>
          <view class="refuse-time u-line-3" style="width: 180rpx;" v-else>
            <view>审核时间：</view>
          {{refuseclass.shenheTime}}
          </view>
          <!-- 积分值 -->
          <view class="refuse-value" v-if="refuseclass.status === '已通过'">{{refuseclass.value}} 积分</view>
          <view class="refuse-value" style="background-color: #f9f9f9;color: #f9f9f9;" v-else>0积分</view>
        </view>

      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: "my-refuseclassification-item",
    props: {
      // 垃圾分类列表项的信息对象
      refuseclass: {
        type: Object,
        default: {},
      },

    },
    data() {
      return {

      };
    },
    methods:{
      toDetail(){
        uni.navigateTo({
          url:'/subpkg/refuse-classification-detail/refuse-classification-detail?id='+this.refuseclass.id
        })
      }
    },
  }
</script>

<style lang="scss">
  .allbox {
    width: 100%;
    height: 240rpx;
    border-radius: 15rpx;
    margin-top: 30rpx;
  }

  .view-img {
    margin-top: 15rpx;
    margin-left: 20rpx;
    border-radius: 15rpx;
    height: 210rpx;
    width: 230rpx;
  }

  .refuse-img {
    border-radius: 15rpx;
    height: 210rpx;
    width: 230rpx;
  }

  .rightbox {
    margin: 15rpx 20rpx;
    padding: 20rpx 0rpx;
  }

  .refuse-topbox {
    display: flex;
    justify-content: space-between;
  }

  .refuse-site {
    font-size: 32rpx;
    width: 200rpx;
  }

  .refuse-status-ing {
    // height: 60rpx;
    // padding: 15rpx 20rpx 0rpx 20rpx;
    // margin-left: 80rpx;
    padding: 20rpx;
    margin-left: 60rpx;
    border-radius: 70rpx;
    font-size: 32rpx;
    background-color: #aaffff;
  }
  
  .refuse-status-finish {
    // height: 60rpx;
    // padding: 15rpx 20rpx 0rpx 20rpx;
    // margin-left: 80rpx;
    padding: 20rpx;
    margin-left: 60rpx;
    border-radius: 70rpx;
    font-size: 32rpx;
    color: #FFFFFF;
    background-color: #00aa00;
  }
  
  .refuse-status-noPass {
    // height: 60rpx;
    // padding: 15rpx 20rpx 0rpx 20rpx;
    // margin-left: 80rpx;
    padding: 20rpx;
    margin-left: 60rpx;
    border-radius: 70rpx;
    font-size: 32rpx;
    color: #303133;
    background-color: #ff0000;
  }

  .refuse-bottombox {
    display: flex;
    justify-content: space-around;
  }

  .refuse-time {
    font-size: 32rpx;
    // margin-top: 10rpx;
    margin-left: -30rpx;
  }

  .refuse-value {
    margin-top: 38rpx;
    font-size: 34rpx;
    color: #ffe45d;
    font-weight: bold;
  }
</style>
